Skip to content

logical: skip outbound fk constraint dependencies on deletes#169781

Open
DarrylWong wants to merge 1 commit intocockroachdb:masterfrom
DarrylWong:fix-fk-as-pk-bug
Open

logical: skip outbound fk constraint dependencies on deletes#169781
DarrylWong wants to merge 1 commit intocockroachdb:masterfrom
DarrylWong:fix-fk-as-pk-bug

Conversation

@DarrylWong
Copy link
Copy Markdown
Contributor

This change fixes a bug where occasionally created a dependency that an FK being deleted is dependent on the PK it is referencing being deleted first. This happens if the FK is the table's own PK, as PK's are always emitted for deletes. This caused us to mistakenly consume the event as an update instead of a delete.

Instead, we gate on the decoded row's IsDelete.

Fixes: #169778
Release note: none

This change fixes a bug where occasionally created a dependency
that an FK being deleted is dependent on the PK it is referencing
being deleted first. This happens if the FK is the table's own
PK, as PK's are always emitted for deletes. This caused us to
mistakenly consume the event as an update instead of a delete.

Instead, we gate on the decoded row's IsDelete.

Fixes: cockroachdb#169778
@trunk-io
Copy link
Copy Markdown
Contributor

trunk-io Bot commented May 5, 2026

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@blathers-crl
Copy link
Copy Markdown

blathers-crl Bot commented May 5, 2026

Detected infrastructure failure (matched: self-hosted runner lost communication with the server). Automatically rerunning failed jobs. (run link)

@DarrylWong DarrylWong marked this pull request as ready for review May 6, 2026 15:14
@DarrylWong DarrylWong requested a review from a team as a code owner May 6, 2026 15:14
@DarrylWong DarrylWong requested review from KeithCh and jeffswenson and removed request for a team May 6, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

logical: primary key that is foreign key causes unexpected lock collision

2 participants